import './index.less'
import Container from "@/views/dataScreen/Container";
import {CanvasContext} from './Context';
import {useCanvas} from "@/utils/canvasHook";
import {useEffect, useReducer} from "react";

const DataScreen = () => {
    // @ts-ignore
    const canvas = useCanvas();
    const [, forceUpdate] = useReducer((x) => x + 1, 0);

    useEffect(() => {
        const unsubscribe = canvas.subscribe(() => {
            forceUpdate();
        });

        return () => {
            unsubscribe();
        };
    }, []);
    return (
        <CanvasContext.Provider value={canvas}>
            <Container/>
        </CanvasContext.Provider>
    );
};

export default DataScreen;
